\(\int \cos (c+d x) (a+b \tan ^2(c+d x)) \, dx\) [427]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 28 \[ \int \cos (c+d x) \left (a+b \tan ^2(c+d x)\right ) \, dx=\frac {b \text {arctanh}(\sin (c+d x))}{d}+\frac {(a-b) \sin (c+d x)}{d} \]

[Out]

b*arctanh(sin(d*x+c))/d+(a-b)*sin(d*x+c)/d

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {3757, 396, 212} \[ \int \cos (c+d x) \left (a+b \tan ^2(c+d x)\right ) \, dx=\frac {(a-b) \sin (c+d x)}{d}+\frac {b \text {arctanh}(\sin (c+d x))}{d} \]

[In]

Int[Cos[c + d*x]*(a + b*Tan[c + d*x]^2),x]

[Out]

(b*ArcTanh[Sin[c + d*x]])/d + ((a - b)*Sin[c + d*x])/d

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rule 3757

Int[sec[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^(n_))^(p_.), x_Symbol] :> With[{ff = F
reeFactors[Sin[e + f*x], x]}, Dist[ff/f, Subst[Int[ExpandToSum[b*(ff*x)^n + a*(1 - ff^2*x^2)^(n/2), x]^p/(1 -
ff^2*x^2)^((m + n*p + 1)/2), x], x, Sin[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] &&
IntegerQ[n/2] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {a-(a-b) x^2}{1-x^2} \, dx,x,\sin (c+d x)\right )}{d} \\ & = \frac {(a-b) \sin (c+d x)}{d}+\frac {b \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\sin (c+d x)\right )}{d} \\ & = \frac {b \text {arctanh}(\sin (c+d x))}{d}+\frac {(a-b) \sin (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.68 \[ \int \cos (c+d x) \left (a+b \tan ^2(c+d x)\right ) \, dx=\frac {b \text {arctanh}(\sin (c+d x))}{d}+\frac {a \cos (d x) \sin (c)}{d}+\frac {a \cos (c) \sin (d x)}{d}-\frac {b \sin (c+d x)}{d} \]

[In]

Integrate[Cos[c + d*x]*(a + b*Tan[c + d*x]^2),x]

[Out]

(b*ArcTanh[Sin[c + d*x]])/d + (a*Cos[d*x]*Sin[c])/d + (a*Cos[c]*Sin[d*x])/d - (b*Sin[c + d*x])/d

Maple [A] (verified)

Time = 0.28 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.39

method result size
derivativedivides \(\frac {b \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+\sin \left (d x +c \right ) a}{d}\) \(39\)
default \(\frac {b \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+\sin \left (d x +c \right ) a}{d}\) \(39\)
risch \(-\frac {i {\mathrm e}^{i \left (d x +c \right )} a}{2 d}+\frac {i {\mathrm e}^{i \left (d x +c \right )} b}{2 d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} a}{2 d}-\frac {i {\mathrm e}^{-i \left (d x +c \right )} b}{2 d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b}{d}\) \(103\)

[In]

int(cos(d*x+c)*(a+b*tan(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(b*(-sin(d*x+c)+ln(sec(d*x+c)+tan(d*x+c)))+sin(d*x+c)*a)

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 44, normalized size of antiderivative = 1.57 \[ \int \cos (c+d x) \left (a+b \tan ^2(c+d x)\right ) \, dx=\frac {b \log \left (\sin \left (d x + c\right ) + 1\right ) - b \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (a - b\right )} \sin \left (d x + c\right )}{2 \, d} \]

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)^2),x, algorithm="fricas")

[Out]

1/2*(b*log(sin(d*x + c) + 1) - b*log(-sin(d*x + c) + 1) + 2*(a - b)*sin(d*x + c))/d

Sympy [F]

\[ \int \cos (c+d x) \left (a+b \tan ^2(c+d x)\right ) \, dx=\int \left (a + b \tan ^{2}{\left (c + d x \right )}\right ) \cos {\left (c + d x \right )}\, dx \]

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)**2),x)

[Out]

Integral((a + b*tan(c + d*x)**2)*cos(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.64 \[ \int \cos (c+d x) \left (a+b \tan ^2(c+d x)\right ) \, dx=\frac {b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )} + 2 \, a \sin \left (d x + c\right )}{2 \, d} \]

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)^2),x, algorithm="maxima")

[Out]

1/2*(b*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1) - 2*sin(d*x + c)) + 2*a*sin(d*x + c))/d

Giac [A] (verification not implemented)

none

Time = 0.41 (sec) , antiderivative size = 48, normalized size of antiderivative = 1.71 \[ \int \cos (c+d x) \left (a+b \tan ^2(c+d x)\right ) \, dx=\frac {b {\left (\log \left ({\left | \sin \left (d x + c\right ) + 1 \right |}\right ) - \log \left ({\left | \sin \left (d x + c\right ) - 1 \right |}\right ) - 2 \, \sin \left (d x + c\right )\right )} + 2 \, a \sin \left (d x + c\right )}{2 \, d} \]

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)^2),x, algorithm="giac")

[Out]

1/2*(b*(log(abs(sin(d*x + c) + 1)) - log(abs(sin(d*x + c) - 1)) - 2*sin(d*x + c)) + 2*a*sin(d*x + c))/d

Mupad [B] (verification not implemented)

Time = 12.08 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.14 \[ \int \cos (c+d x) \left (a+b \tan ^2(c+d x)\right ) \, dx=\frac {\sin \left (c+d\,x\right )\,\left (a-b\right )}{d}+\frac {2\,b\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d} \]

[In]

int(cos(c + d*x)*(a + b*tan(c + d*x)^2),x)

[Out]

(sin(c + d*x)*(a - b))/d + (2*b*atanh(tan(c/2 + (d*x)/2)))/d